#pragma once
#include "CAutomationPeer.h"
#include "CDependencyObject.h"


class CFrameworkElement;

class CFrameworkElementAutomationPeer :
	public CAutomationPeer
{

public: 
	virtual ~CFrameworkElementAutomationPeer();
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;

	virtual CAutomationPeer * GetAPParent();

	virtual CAutomationPeer * GetAPTemplatedParentFirst();
	virtual XINT32 GetChildrenCore(struct Xcp_IAutomationPeer * * * pppReturnAP);
	virtual XINT32 GetRootChildrenCore(struct Xcp_IAutomationPeer * * * pppReturnAP);
	virtual struct IUIAProvider * GetPatternCore(enum UIAXcp::APPatternInterface ePattern);
	virtual HRESULT GetAcceleratorKeyCore(CXString * * pRetVal);
	virtual HRESULT GetAccessKeyCore(CXString * * pRetVal);
	virtual HRESULT GetAutomationControlTypeCore(enum UIAXcp::APAutomationControlType * pRetVal);
	virtual HRESULT GetAutomationIdCore(CXString * * pRetVal);
	virtual HRESULT GetClassNameCore(CXString * * pRetVal);
	virtual HRESULT GetHelpTextCore(CXString * * pRetVal);
	virtual HRESULT GetItemStatusCore(CXString * * pRetVal);
	virtual HRESULT GetItemTypeCore(CXString * * pRetVal);
	virtual HRESULT GetLabeledByCore(struct Xcp_IAutomationPeer * * pRetVal);
	virtual HRESULT GetNameCore(CXString * * pRetVal);
	virtual HRESULT GetOrientationCore(enum UIAXcp::OrientationType * pRetVal);
	virtual HRESULT GetLiveSettingCore(enum UIAXcp::LiveSetting * pRetVal);
	virtual HRESULT HasKeyboardFocusCore(XINT32 * pRetVal);
	virtual HRESULT IsContentElementCore(XINT32 * pRetVal);
	virtual HRESULT IsControlElementCore(XINT32 * pRetVal);
	virtual HRESULT IsEnabledCore(XINT32 * pRetVal);
	virtual HRESULT IsKeyboardFocusableCore(XINT32 * pRetVal);
	virtual HRESULT IsOffscreenCore(XINT32 * pRetVal);
	virtual HRESULT IsPasswordCore(XINT32 * pRetVal);
	virtual HRESULT IsRequiredForFormCore(XINT32 * pRetVal);
	virtual void SetFocusCore();
	virtual HRESULT GetBoundingRectangleCore(struct XRECTF_WH * * pRetVal);
	virtual HRESULT GetClickablePointCore(struct XPOINTF * * pRetVal);
	virtual void InvalidateOwner();
	HRESULT ThrowElementNotAvailableError();

protected: 
	CFrameworkElementAutomationPeer(CCoreServices * pCore, CValue & value);
	CDependencyObject * m_pDO;
private: 
	static XBOOL IsElementOffscreen(CFrameworkElement * pElement);


};